/**
 * 
 */
package np.com.baralsujan.controller;

import np.com.baralsujan.login.domain.User;
import np.com.baralsujan.login.service.impl.UserService;
import np.com.baralsujan.login.util.AuthenticationException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author sbara1
 *
 */
@Controller
public class LoginController {
	
	@Autowired
	private UserService userService;
	
	public ModelAndView login() {
		User user = new User();
		user.setUserName("baralsujan");
		user.setPassword("password");
		user.setActive(true);
		try {
			user = userService.authenticateUser(user);
		} catch (AuthenticationException e) {
			e.printStackTrace();
		}
		return new ModelAndView("home", "user", user);
	}

}
